/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author XYMTOP
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface TbSupplierOrder extends BasicModel<TbSupplierOrder> {
  supplierOrderId?: string; // 供应商订单编号
  oderId?: string; // 该订单所属主订单编号
  supplierId?: string; // 供应商ID号
  createTime?: string; // 订单创建时间（派单时间）
  acceptTime?: string; // 供应商接单时间
  finishTime?: string; // 供应商完成时间
  comment?: string; // 备注
  deleted?: number; // 逻辑删除（0正常，1删除）
}

export const tbSupplierOrderList = (params?: TbSupplierOrder | any) =>
  defHttp.get<TbSupplierOrder>({ url: adminPath + '/tb/tbSupplierOrder/list', params });

export const tbSupplierOrderListData = (params?: TbSupplierOrder | any) =>
  defHttp.post<Page<TbSupplierOrder>>({ url: adminPath + '/supplierOrder/listData', params });

export const tbSupplierOrderForm = (params?: TbSupplierOrder | any) =>
  defHttp.get<TbSupplierOrder>({ url: adminPath + '/tb/tbSupplierOrder/form', params });

export const tbSupplierOrderSave = (params?: any, data?: TbSupplierOrder | any) =>
  defHttp.postJson<TbSupplierOrder>({ url: adminPath + '/supplierOrder/save', params, data });

export const tbSupplierOrderDelete = (params?: TbSupplierOrder | any) =>
  defHttp.get<TbSupplierOrder>({ url: adminPath + '/supplierOrder/delete', params });

// 获取到所有的供应商
export const tbFindAllSupplier = (params?: any) =>
  defHttp.get<TbSupplierOrder>({ url: adminPath + '/supplierOrder/find_all_supplier', params });

//供应商完成订单
export const tbSupplierFinish = (params?: any) =>
  defHttp.post({ url: adminPath + '/supplierOrder/finishSupplierOrder', params });
